<?php

namespace Soonpage\View\Helper;

use Zend\View\Helper\AbstractHelper;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use \Zend\ServiceManager\ServiceLocatorAwareTrait;

class HeaderHelper extends AbstractHelper implements ServiceLocatorAwareInterface {

  var $serviceTranslator = null;
  var $root_url = null;

  /** 
   * Set the service locator. 
   * 
   * @param ServiceLocatorInterface $serviceLocator 
   * @return CustomHelper 
   */  
  public function setServiceLocator(ServiceLocatorInterface $serviceLocator)  
  {  
      $this->serviceLocator = $serviceLocator;  
      return $this;  
  }  
  /** 
   * Get the service locator. 
   * 
   * @return \Zend\ServiceManager\ServiceLocatorInterface 
   */  
  public function getServiceLocator()  
  {  
      return $this->serviceLocator;  
  }


	public function __invoke() {

    $this->serviceTranslator = $this->getServiceLocator()->getServiceLocator()->get('translator'); 
    $config = $this->getServiceLocator()->getServiceLocator()->get('config'); 

    $this->root_url = $config['root_url'];

    $description = $this->serviceTranslator->translate("Reseaux Socials Description");
    $description_twitter = $this->serviceTranslator->translate("Reseaux Socials Description Twitter");

    $navHtml = <<<EOQ
		<nav id="soonpage-header" class="navbar navbar-transparent navbar-fixed-top" role="navigation">  
          <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href="/">1001Treks.com</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="/qui-sommes-nous">Qui sommes nous ?</a>
                    </li>
                    <li>
                        <a href="/nous-contacter">Nous contacter</a>
                    </li>
                </ul>
              <!-- <ul class="nav navbar-nav">
                 <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown"> 
                        <img src="images/flags/US.png"/>
                        English(US) 
                        <b class="caret"></b>
                      </a>
                      <ul class="dropdown-menu">
                        <li><a href="#"><img src="images/flags/GB.png"/> English(UK)</a></li>
                        <li><a href="#"><img src="images/flags/FR.png"/> Français</a></li>
                        
                        <li class="divider"></li>
                        <li><a href="#"><img src="images/flags/ES.png"/> Español <span class="label label-default">soon</span></a></li>
                      </ul>
                </li>
              </ul> -->
              <ul class="nav navbar-nav navbar-right">
                    <li>

                        <a target="_blank" title="Facebook" href="https://www.facebook.com/sharer.php?u=$this->root_url&t=$description" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');return false;">
                            <i class="fa fa-facebook-square"></i>
                            Partager
                        </a>

                    </li> 
                    <li>

                        <a target="_blank" title="Google +" href="https://plus.google.com/share?url=$this->root_url&hl=fr" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;">
                            <i class="fa fa-google-plus"></i>
                            Google+
                        </a>
                    </li>
                    <li>

                        <a target="_blank" title="Twitter" href="https://twitter.com/share?url=''&text=$description_twitter&via=1001Treks" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;">
                            <i class="fa fa-twitter"></i>
                            Tweet
                        </a>

                    </li>
                    <!--<li>

                        <a target="_blank" title="Envoyer par mail" href="mailto:?subject=$description&body=$this->root_url" rel="nofollow">
                            <i class="fa fa-envelope-o"></i>
                            Email
                        </a>

                    </li>-->
               </ul>
              
            </div><!-- /.navbar-collapse -->
          </div><!-- /.container -->
        </nav>
        <div class="main" style="background-image: url('/img/bg.jpg')">

        <!--    Change the image source '/images/default.jpg' with your favourite image.     -->
            
            <div class="cover black" data-color="black"></div>
             
        <!--   You can change the black color for the filter with those colors: blue, green, red, orange       -->
EOQ;
		
		return $navHtml;
	}
}
